package com.lsy.clearssm.service.impl;

import com.lsy.clearssm.mapper.UserMapper;
import com.lsy.clearssm.pojo.User;
import com.lsy.clearssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author LSY
 * @Date 2021/10/22 8:15
 * @Version 1.0
 **/
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User findUserById(Long id) {
        return userMapper.findUserById(1L);
    }

    @Override
    @Transactional
    public int delUserByIds(List<Long> list) {
        int i = 1/0;
        return userMapper.delUserByIds(list);
    }

    @Override
    @Transactional
    public int addUser(User user) {
        System.out.println(user);
        int result1 = userMapper.addUser(user);
        user.setPhone(user.getPhone() + "1");
        int i = 1/0;
        int result2 = userMapper.addUser(user);
        return 1;
    }
}
